package com.dl.chat.service;

import com.dl.chat.entity.ChatHistory;
import com.dl.chat.mapper.ChatHistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChatHistoryService {

    @Autowired
    private ChatHistoryMapper chatHistoryMapper;

    public void saveChatHistory(ChatHistory chatHistory) {
        chatHistoryMapper.insert(chatHistory);
    }

    public List<ChatHistory> getChatHistoryByUserId(String userId) {
        return chatHistoryMapper.selectByUserId(userId);
    }

    public void deleteChatHistory(Long id) {
        chatHistoryMapper.deleteById(id);
    }
}